<%@ page import="com.baizhi.entity.Title" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="com.baizhi.entity.User" %>
<%@ page pageEncoding="UTF-8" contentType="text/html; UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Web Tech Template - Free CSS Layout</title>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <link href="css/templatemo_style.css" rel="stylesheet" type="text/css"/>
    <script src="jquery.js" type="text/javascript" charset="utf-8"></script>

</head>
<body>
<%
    User users = (User)session.getAttribute("u");
    System.out.println("页面4"+users);
%>

<div id="templatemo_header">

    <div id="site_title">

        <a href="#">删除文章</a>
        <%--        <span style="display: block;float: left;font-weight: normal;text-decoration: none;color: #da9d0c;font-size: 15px;padding-left: 60px">&nbsp  人关注</span>--%>
    </div> <!-- end of site_title -->

    <div id="header_right">

        <!--    	<a href="#"><img src="images/templatemo_twitter.png" alt="twitter" /></a><a href="#"><img src="images/templatemo_rss.png" alt="rss" /></a>-->

        <div id="newsletter_box">
            <form action="#" method="get">
                <p>搜索</p>
                <input type="text" id="user" name="user" class="newsletter_email" color="#000000" placeholder="请输入"
                       onfocus="clearText(this)" onblur="clearText(this)"/>
                <input style="font-weight: bold;" type="submit" name="submit" id="submit" value=""/>
            </form>
        </div>

    </div>

    <div class="cleaner"></div>

</div> <!-- end of header -->

<div id="templatemo_menu_wrapper">

    <div id="templatemo_menu">
        <ul>
            <li><a href="${pageContext.request.contextPath}/findArticleByPageServlet"
                   style="cursor:default"><span></span>首页</a></li>
            <li><a href="#"><span></span>关注</a></li>
            <li><a href="${pageContext.request.contextPath}/write_blog.jsp"><span></span>发表博客</a></li>
            <li><a href="JavaScript:void(0)" class="current"><span></span>删除文章</a></li>
        </ul>
    </div>
</div> <!-- end of templatemo_menu -->


<div id="templatemo_main"><span class="tm_bottom"></span>

    <div id="templatemo_content">

        <div class="content_box" style="margin-bottom: 0px;padding-bottom: 10px">
            <form action="<%=request.getContextPath()%>/TitleDelet" method="post">
            <%
                SimpleDateFormat sdf = new SimpleDateFormat("MM/dd  yyyy");
                String datetime =sdf.format(new Date());
                HttpSession session1 = request.getSession();
                session1.setAttribute("name",users.getName());
                session1.setAttribute("date",datetime);
                Title title = (Title)request.getAttribute("title1");
                System.out.println("页面获取文本内容"+title);
            %>

            <h2 style="color: #20c4d3;"><span>文章标题</span></h2>
            <input type="text" style="outline: 0;
    padding: 12px 15px;
    border-radius: 25px;
    border: none;
    background-color: rgba(87, 102, 103, 0.59);
    color: white;
    width: 90%;
    letter-spacing: 1px;" id="title" name="title" value="<%=title.getTitle()%>"/>

        </div>

        <div class="post_box">
            <form action="<%=request.getContextPath()%>/TitleUpdate" method="post">
            <div class="header">
                <h3 style="padding: 0"><p style="color: white;">设置关键字</p></h3>
                <div class="tag" style="margin-top: 10px"><strong>Tags:</strong> <input id="tag" name="tag" type="text" style="outline: 0;
    padding: 12px 15px;
    border-radius: 25px;
    border: none;
    background-color: rgba(87, 102, 103, 0.59);
    color: white;
    width: 10%;
    letter-spacing: 1px;" value="<%=title.getKeyWord()%>"/></div>
                <span class="posted_date">
                                 <strong><%=title.getDate()%></strong>
                              </span>
            </div>
                <img src="images/toux.jpg" alt="image" />
               <div class="pb_right" style="display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 5;">
           
                           <div class="like">赞(<%=title.getLikeCount()%>)</div>
                            <div class="comment">评论()</div>
                      </div>
            <div id="textAreaBox">
                <div id="innerBox">
                    <div id="introduce">
                        <h3 style="color:white;"><p>书写正文</p></h3>
                    </div>
                    <textarea id="text" name="text" rows="50" cols="60"
                              style="resize:none;margin: 0px;width: 95%;height: 500px;padding-left: 0px;padding-right: 0px;border-left-width: 0px;border-right-width: 0px;background-color: transparent;color: white"><%=title.getText()%>
                    </textarea>
                    <button id="submitArticle" type="submit"
                            style="margin-top:10px;margin-right:5%;width: 20%;float: right;height: 35px;background-color: transparent;border-color: #da9d0c;border-style: groove;color: darkgray">
                        确认删除
                    </button>
                </div>
            </div>
            <div class="cleaner"></div>
            </form>
        </div>

    </div>

    <div id="templatemo_sidebar">
        <div class="sidebar_box">
            <h3>Tag Cloud</h3>
            <div class="sb_content">
                <a href="#" style="font-size:12px">Aenean</a> <a href="#" style="font-size:11px">Cursus</a> <a href="#"
                                                                                                               style="font-size:16px">Maecenas</a>
                <a href="#" style="font-size:11px">Aliquam Ligula</a> <a href="#" style="font-size:20px">Egestas</a> <a
                    href="#" style="font-size:16px">Suscipit</a> <a href="#" style="font-size:12px">Sapien</a> <a
                    href="#" style="font-size:28px">Dignissim</a> <a href="#" style="font-size:14px">Vestibulum</a> <a
                    href="#" style="font-size:12px">Lorem</a> <a href="#" style="font-size:14px">Urnain</a> <a href="#"
                                                                                                               style="font-size:20px">Neque</a>
                <a href="#" style="font-size:12px">Aenean</a>
            </div>
        </div>

        <div class="sidebar_box">
            <h3>Categories</h3>
            <div class="sb_content">
                <ul class="sidebar_menu">
                    <li><a href="#">CSS Techniques</a></li>
                    <li><a href="#">Web Design Tips</a></li>
                    <li><a href="#">Best Wallpapers</a></li>
                    <li><a href="#">Free Fonts</a></li>
                    <li><a href="#">Photoshop Tutorials</a></li>
                    <li><a href="#">3D Animation Tutorials</a></li>
                </ul>
            </div>
        </div>

        <div class="sidebar_box">
            <h3>Archives</h3>
            <div class="sb_content">
                <ul class="sidebar_menu">
                    <li><a href="#">CSS Templates</a></li>
                    <li><a href="#">Web Design Ideas</a></li>
                    <li><a href="#">Free Wallpapers</a></li>
                    <li><a href="#">Free Pixel Fonts</a></li>
                    <li><a href="#">Illustrator Tutorials</a></li>
                    <li><a href="#">3D Character Tutorials</a></li>
                </ul>
            </div>
        </div>

        <!--        <div class="sidebar_box">-->
        <!--        	<h3>Our Friends</h3>-->
        <!--            <div class="sb_content">-->
        <!--            	<ul class="sidebar_menu">-->
        <!--                    <li><a href="#">Free Flash Files</a></li>-->
        <!--                    <li><a href="#">Free CSS Templates</a></li>-->
        <!--                    <li><a href="#">Web Design Tips</a></li>-->
        <!--                    <li><a href="#">Flash XML Galleries</a></li>-->
        <!--                    <li><a href="#">Inspiring Flash Websites</a></li>-->
        <!--                </ul>-->
        <!--            </div>-->
        <!--        </div>-->
    </div>

    <div class="cleaner"></div>
</div> <!-- end of main -->

<div id="templatmeo_bottom">
    <div class="bottom_box">
        <h5><span>Sed Necest</span> Suspendisse a nibh</h5>
        <p>Duis vitae velit sed dui malesuada dignissim. Donec mollis aliquet ligula. Maecenas adipiscing elementum
            ipsum.</p>
        <a href="#" class="continue">more info</a>
    </div>

    <div class="bottom_box">
        <h5><span>Lorem ipsum</span> dolor sit amet</h5>
        <p>Vestibulum eleifend, enim ut molestie pulvinar, purus est fringilla augue, ut tristique nunc neque a
            libero.</p>
        <a href="#" class="continue">more info</a>
    </div>

    <div class="bottom_box">
        <h5><span>Recent</span> Blog Post</h5>
        <ul class="bottom_box_list">
            <li><a href="#">Duis vitae velit sed lesuada dignissim.</a></li>
            <li><a href="#">Donec mollis aliquet ligula.</a></li>
            <li><a href="#">Maecenas adipiscing elementum ipsum.</a></li>
        </ul>
    </div>

</div> <!-- end of bottom -->

<div id="templatemo_footer">

    <ul class="footer_menu">
        <li class="first"><a href="#">Home</a></li>
        <li><a href="#">Web 2.0</a></li>
        <li><a href="#">Wordpress</a></li>
        <li><a href="#">Graphics</a></li>
        <li><a href="#">Inspirations</a></li>
        <li><a href="#">Freebies</a></li>
    </ul>

    Copyright © 2048 <a href="#">Your Company Name</a> <!-- Credit: www.templatemo.com -->|
    Validate <a href="http://validator.w3.org/check?uri=referer">XHTML</a> &amp; <a
        href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>

</div>
<!-- templatemo 205 web tech -->
<!--
Web Tech Template
http://www.templatemo.com/preview/templatemo_205_web_tech
-->
<script>
    let title = $("#title")
    let text = $("#text")
    let tag = $("#tag")
    let submit = $("#submitArticle")

    submit.click(
        function () {
            // alert("click执行")
            var myDate = new Date();
            var nowDateTime = myDate.getFullYear();
            nowDateTime = nowDateTime + ((myDate.getMonth() + 1) < 10 ? "-0" + (myDate.getMonth() + 1) : "-" + (myDate.getMonth() + 1));
            nowDateTime = nowDateTime + (myDate.getDate() < 10 ? "-0" + myDate.getDate() : "-" + myDate.getDate());
            // year = date.getFullYear();
            // month = date.getMonth()+1;
            // day = date.getDate();
            // str = year+"-"+month+"-"+day
            // alert("nowDateTime"+nowDateTime)

            let titleText = title.val();
            // alert("titleText"+titleText)
            let textText = text.val();
            // alert("textText"+textText)
            let tagText = tag.val();
            // alert("tagText"+tagText)

            $.ajax({
                url: "/updateArticleServlet",
                type: "POST",
                dateType: "text",
                data: {
                    "aid":${article.aid},
                    "title": titleText,
                    "text": textText,
                    "keyWord": tagText,
                    "date": nowDateTime,
                    "uid": "${all.user.userId}"
                },
                success(result) {
                    window.location.href = "${pageContext.request.contextPath}/findArticleByPageServlet";
                },
                error() {
                    alert("error")
                }
            })
</script>
</body>
</html>